package com.ntschy.sys.entity.dto.user;

import com.ntschy.common.core.entity.enums.SysSexEnum;
import com.ntschy.common.valid.phone.Phone;
import com.ntschy.sys.entity.valid.SysUserGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author ezreal_geng
 */
@Data
@ApiModel(description = "用户新增更新dto")
public class SysUserAddUpdateDTO implements Serializable {


    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户ID")
    @NotBlank(message = "用户ID不能为空", groups = SysUserGroups.Update.class)
    @Length(min = 36, max = 36, message = "用户ID长度不合法", groups = SysUserGroups.Update.class)
    private String id;

    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "用户名不能为空", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    @Length(min = 2, max = 10, message = "用户名长度必须为2-10位", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private String userName;

    @ApiModelProperty(value = "手机号码")
    @Phone(must = true, message = "手机号码格式错误", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private String mobile;

    @ApiModelProperty(value = "用户性别 1=男，2=女")
    @NotNull(message = "用户性别不能为空", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private SysSexEnum sex;

    @ApiModelProperty(value = "角色ID")
    @NotBlank(message = "用户角色ID不能为空", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    @Length(min = 36, max = 36, message = "用户角色ID长度不合法", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private String roleId;

    @ApiModelProperty(value = "部门ID")
//    @NotBlank(message = "用户部门ID不能为空", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
//    @Length(min = 36, max = 36, message = "用户部门ID长度不合法", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private String deptId;

    @ApiModelProperty(value = "单位ID")
    @NotBlank(message = "用户单位ID不能为空", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    @Length(min = 36, max = 36, message = "用户单位ID长度不合法", groups = { SysUserGroups.Add.class, SysUserGroups.Update.class })
    private String companyId;

    @ApiModelProperty(value = "备注")
    private String remark;
}
